/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package view;

import model.DB2Hash;

/**
 *
 * @author aeguzkiza
 */
public class Physician {
    Integer id;
    DB2Hash physician;
    public String physiciansFullName;

    // Physician(DB2Hash physician){
    public Physician(DB2Hash physician){
        this.id = Integer.parseInt(physician.get("Id"));
        this.physician = physician;
    }

    public DB2Hash getPhysician(){
        return physician;
    }    
    public Integer getPhysicianId(){
        return id;
    }
    public void setPhysicianId(Integer Id){
        this.id = Id;
    }
    public void setPhysiciansFullName(String PhysiciansFullName){
        this.physiciansFullName = PhysiciansFullName;
    }
    public String toString() {
        String PerformingPhysiciansName = physician.get("PerformingPhysiciansName");
        String PerformingPhysiciansSurName = physician.get("PerformingPhysiciansSurName");

        this.physiciansFullName = PerformingPhysiciansName+" "+PerformingPhysiciansSurName;
        return physiciansFullName;
    }
    public boolean equals(Object i) {
        if(i instanceof Physician) {
            Physician item = (Physician)i;
            if(getPhysicianId().equals(item.getPhysicianId())) {
                return true;
            }else {
                //System.out.println("I was asked if I was " + item + " but I'm " + id + " as I'm " + physiciansFullName);
                return super.equals(i);
            }
        }else return super.equals(i);
    }

    /*@Override
    public boolean equals(Object o) {
         if (o == null) {
             return false;
         }
         if (this == o) {
             return true;
         }
         if (!(o instanceof Physician)) {
             return false;
         }
         Physician physician = (Physician) o;
         if (id != physician.id) {
             return false;
         }
         if (PhysiciansFullName != null ? !PhysiciansFullName.equals(physician.PhysiciansFullName) : physician.PhysiciansFullName != null) {
             return false;
         }
         return true;
    }
    @Override
    public int hashCode() {
     int hash = 3;
     hash = 89 * hash + (this.PhysiciansFullName != null ? this.PhysiciansFullName.hashCode() : 0);
     hash = 89 * hash + this.id;
     return hash;
    }*/
}
